package com.da.javatest.niuke.jianzhi;

import java.util.Stack;

/**
 * @author chenlida
 * @date 2020/10/20 16:34
 * https://www.nowcoder.com/practice/54275ddae22f475981afa2244dd448c6?
 * tpId=13&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 */
public class C5Solution {
    Stack<Integer> stack1 = new Stack<>();
    Stack<Integer> stack2 = new Stack<>();

    public void push(int node) {
        stack1.push(node);
    }

    public int pop() {
        if (stack2.empty()) {
            while (!stack1.empty()) {
                stack2.push(stack1.pop());
            }
        }
        return stack2.pop();
    }
}
